package com.cwj.scalableIO;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @author: Chenwujie
 * @date: 2021-07-20 15:10
 */
public class Client {
    public static void main(String[] args) {
        try {
            Socket localhost = new Socket("localhost", 6666);
            OutputStream outputStream = localhost.getOutputStream();
            outputStream.write("hello".getBytes());
            localhost.shutdownOutput();

            InputStream inputStream = localhost.getInputStream();
            byte[] data = new byte[1024];
            inputStream.read(data);
            System.out.println(new String(data));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
